<?php
$sql['0'] = "CREATE TABLE `" . DB_PREFIX . "admin` (
  `id` int(10) NOT NULL AUTO_INCREMENT COMMENT 'admin id',
  `username` varchar(20) NOT NULL COMMENT 'admin username',
  `password` varchar(32) NOT NULL COMMENT 'admin password',
  `fname` varchar(32) DEFAULT NULL COMMENT 'admin first name',
  `lname` varchar(32) DEFAULT NULL COMMENT 'admin last name',
  `nickname` varchar(32) DEFAULT NULL COMMENT 'admin nick name',
  `avatar` int(10) DEFAULT NULL COMMENT 'admin avatar',
  `email` varchar(50) DEFAULT NULL COMMENT 'admin email',
  `level` int(2) DEFAULT '2' COMMENT '1 = super admin, 2 = admin, 3 = ???',
  `date_signup` varchar(20) DEFAULT NULL COMMENT 'date to signup',
  `date_update` varchar(20) DEFAULT NULL COMMENT 'date to update',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci";

$sql['1'] = "CREATE TABLE `" . DB_PREFIX . "users` (
  `id` int(10) NOT NULL AUTO_INCREMENT COMMENT 'user id',
  `user_group_id` int(10) NOT NULL DEFAULT '1' COMMENT 'user permission group',
  `username` varchar(32) NOT NULL COMMENT 'user username',
  `password` varchar(32) NOT NULL COMMENT 'user password',
  `fname` varchar(50) DEFAULT NULL COMMENT 'user first name',
  `lname` varchar(50) DEFAULT NULL COMMENT 'user last name',
  `nickname` varchar(50) DEFAULT NULL COMMENT 'user nickname',
  `avatar` int(10) DEFAULT NULL COMMENT 'user avatar',
  `sex` tinyint(2) NOT NULL DEFAULT '0' COMMENT '0=femail,1=mail,2=???',
  `email` varchar(50) DEFAULT NULL COMMENT 'user email',
  `address` varchar(100) DEFAULT NULL COMMENT 'user address',
  `tumbon` varchar(100) DEFAULT NULL COMMENT 'user tumbon',
  `amphur` varchar(100) DEFAULT NULL COMMENT 'user amphur',
  `province` varchar(100) DEFAULT NULL COMMENT 'user privince',
  `postcode` int(5) DEFAULT NULL COMMENT 'user postcode',
  `mobile` varchar(12) DEFAULT NULL COMMENT 'user mobile phone',
  `telephone` varchar(15) DEFAULT NULL COMMENT 'user telephone',
  `birthday` varchar(20) DEFAULT NULL COMMENT 'user birthday',
  `education` varchar(50) DEFAULT NULL COMMENT 'user education',
  `work` varchar(50) DEFAULT NULL COMMENT 'user working',
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 = unverify, 1 = verified',
  `date_signup` varchar(20) DEFAULT NULL COMMENT 'user signup date',
  `date_update` varchar(20) DEFAULT NULL COMMENT 'user update date',
  `lastvisit` varchar(20) DEFAULT NULL COMMENT 'user last visit',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci";

$sql['2'] = "CREATE TABLE `" . DB_PREFIX . "avatar` (
  `id` int(10) NOT NULL COMMENT 'avatar id',
  `avatar` varchar(100) NOT NULL COMMENT 'user path picture',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci";

$sql['3'] = "CREATE TABLE `" . DB_PREFIX . "blocks` (
  `id` int(55) NOT NULL AUTO_INCREMENT,
  `title` varchar(255) NOT NULL DEFAULT 'No title',
  `content` text NOT NULL,
  `type` enum('php','plain') NOT NULL DEFAULT 'plain',
  `system` enum('no','yes') NOT NULL DEFAULT 'no',
  `position` enum('left','right') NOT NULL DEFAULT 'left',
  `height` tinyint(3) NOT NULL DEFAULT '0',
  `visible` enum('yes','no') NOT NULL DEFAULT 'yes',
  `owner` varchar(30) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci";

$sql['4'] = "CREATE TABLE `" . DB_PREFIX . "modules` (
  `id` int(55) NOT NULL AUTO_INCREMENT,
  `date` date NOT NULL DEFAULT '0000-00-00',
  `folder` varchar(60) NOT NULL,
  `name` varchar(60) NOT NULL,
  `hasadmin` enum('yes','no') NOT NULL DEFAULT 'yes',
  `hasfront` enum('yes','no') NOT NULL DEFAULT 'yes',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci";

$sql['5'] = "CREATE TABLE `" . DB_PREFIX . "groups` (
  `id` int(10) NOT NULL AUTO_INCREMENT COMMENT 'group id',
  `name` varchar(20) DEFAULT NULL COMMENT 'group name',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci";

$sql['6'] = "CREATE TABLE `" . DB_PREFIX . "blocks` (
  `id` int(55) NOT NULL AUTO_INCREMENT,
  `title` varchar(255) NOT NULL DEFAULT 'No title',
  `content` text NOT NULL,
  `type` enum('php','plain') NOT NULL DEFAULT 'plain',
  `system` enum('no','yes') NOT NULL DEFAULT 'no',
  `position` enum('left','right') NOT NULL DEFAULT 'left',
  `height` tinyint(3) NOT NULL DEFAULT '0',
  `visible` enum('yes','no') NOT NULL DEFAULT 'yes',
  `owner` varchar(30) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci";

$sql['7'] = "CREATE TABLE `" . DB_PREFIX . "images` (
  `id` int(55) NOT NULL AUTO_INCREMENT,
  `filename` varchar(255) NOT NULL,
  `filesize` varchar(30) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci";

$sql['8'] = "CREATE TABLE `" . DB_PREFIX . "content` (
  `id` int(55) NOT NULL AUTO_INCREMENT,
  `title` varchar(255) NOT NULL,
  `keywords` varchar(255) NOT NULL,
  `description` varchar(255) NOT NULL,
  `date` date NOT NULL DEFAULT '0000-00-00',
  `content` text NOT NULL,
  `front` enum('no','yes') NOT NULL DEFAULT 'no',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci";

$sql['9'] = "CREATE TABLE `" . DB_PREFIX . "permission` (
  `permission_id` int(11) NOT NULL AUTO_INCREMENT,
  `permission_type` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
  `permission_page` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `permission_desc` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`permission_id`)
) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$sql['10'] = "CREATE TABLE `" . DB_PREFIX . "user_group` (
  `user_group_id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `permission` text CHARACTER SET utf8,
  PRIMARY KEY (`user_group_id`)
) ENGINE=MyISAM AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";

$sql['11'] = "INSERT INTO `" . DB_PREFIX . "blocks` VALUES (1, 'Sample block', 'This is just a sample block.', 'plain', 'no', 'left', 0, 'yes', 'system');";

$sql['12'] = "INSERT INTO `" . DB_PREFIX . "blocks` VALUES (2, 'Sample block', 'This is just a sample block.', 'plain', 'no', 'left', 0, 'yes', 'system');";

?>